package com.ibiaoke.boss.controller;

import com.ibiaoke.common.base.Page;
import com.ibiaoke.system.service.FloorService;
import com.ibiaoke.common.response.Res;
import com.ibiaoke.system.entity.Floor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * 楼层
 * Created by Administrator on 2017/6/15.
 */
@Controller
public class FloorController {

    @Autowired
    private FloorService floorService;

    /**
     * 添加Floor
     *
     * @param floor
     * @return
     */
    @ResponseBody
    @RequestMapping("/saveFloor")
    public Res saveBanner(Floor floor) {
        floorService.saveFloor(floor);
        return Res.create();
    }

    /**
     * 修改Floor
     *
     * @param floor
     * @return
     */
    @ResponseBody
    @RequestMapping("/updateFloorById")
    public Res updateBannerById(Floor floor) {
        floorService.updateFloor(floor);
        return Res.create();

    }

    /**
     * 删除Floor
     *
     * @param floorId
     * @return
     */
    @ResponseBody
    @RequestMapping("/deleteFloorById")
    public Res deleteFloorById(Integer floorId) {
        floorService.deleteFloorById(floorId);
        return  Res.create();
    }

    /**
     * 查询Floor
     *
     * @return
     */
    @ResponseBody
    @RequestMapping("/listFloor")
    public Res listBanner(Integer position, Page page, Integer shopId) {
        List<Floor> floors=floorService.listFloor(position, null, shopId, page);
        return Res.create().addResponse("floors",floors).addResponse("page",page);
    }
}
